package 课堂;

import java.io.IOException;
import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author song
 * @date 2017/11/10 16:31
 */
public class 计算器 {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        int x = 0;
        int y = 0;
        try {
            x = scanner.nextInt();
        } catch (InputMismatchException e) {
            e.printStackTrace();
            System.out.println("请输入正确的数字");
        }
        char c = (char) System.in.read();
        try {
            y = scanner.nextInt();
        } catch (InputMismatchException e) {
            e.printStackTrace();
            System.out.println("请输入正确的数字");
        }
        try {
            System.out.println(c == '+' ? x + y : (c == '-' ? x - y : (c == '*' ? x * y : (c == '/' ? x / y : "请输入正确的字符"))));
        } catch (ArithmeticException e) {
            e.printStackTrace();
            System.out.println("除数不能为0   算术错误");
        }
    }
}
